(function(){

    var resOK = {
        farewell: "调用事件返回值啊啊啊啊"
    };

    var resError = {
        farewell: "类型不正确"
    };

    chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
        console.log("监听事件广播" + sender.tab.url);

        if (request.type === "rankingMsg"){
            sendResponse(resOK);
        }else if(request.type === "5166000"){//淘宝页面就注入淘宝的js
            chrome.tabs.executeScript(null, {file: "js/5166000.js"});
            sendResponse(resOK);
        }else{
            sendResponse(resError);
        }
    });

})();
